--drop table seqbig_tmp
SELECT CODPREN, N_MOD, N_SEQ INTO SEQBIG_TMP FROM biglietti where DATA_EMISS between '2013-01-01 00:00:00' and getdate()
--SELECT * FROM SEQBIG_TMP


DECLARE @CODPREN VARCHAR(14), @N_MOD INT, @N_SEQ INT
 DECLARE CURSORE CURSOR FOR SELECT TOP 100 CODPREN, N_MOD, N_SEQ FROM SEQBIG_TMP
 OPEN CURSORE
 FETCH NEXT FROM CURSORE INTO @CODPREN, @N_MOD, @N_SEQ
 WHILE @@FETCH_STATUS=0
 BEGIN
	EXEC POPOLA_DATITAX_IVA @CODPREN, @N_MOD, @N_SEQ
	FETCH NEXT FROM CURSORE INTO @CODPREN, @N_MOD, @N_SEQ
 END
 CLOSE CURSORE
 DEALLOCATE CURSORE